package chaw.android.train;

import chaw.android.train.MoreActivities.MoreAccountActivity;
import chaw.android.train.MoreActivities.MoreAnnounceActivity;
import chaw.android.train.MoreActivities.MoreConfigActivity;
import chaw.android.train.MoreActivities.MoreDevActivity;
import chaw.android.train.MoreActivities.MoreHelpActivity;
import chaw.android.train.MoreActivities.MoreNoticeActivity;
import chaw.android.train.MoreActivities.MoreSpecialActivity;
import chaw.android.train.MoreActivities.MoreStoryActivity;
import chaw.android.train.MoreActivities.MoreVersionActivity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;

public class MoreHomeActivity extends Activity implements OnClickListener {
	private ImageButton btnMoreAccount, btnMoreStory, btnMoreNotice, btnMoreAnnounce, btnMoreSpecial, btnMoreDev, btnMoreHelp, btnMoreVersion, btnMoreConfig;
	
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
        setContentView(R.layout.more_home);
        
        btnMoreAccount = (ImageButton) findViewById(R.id.btnMoreAccount);
        btnMoreStory = (ImageButton) findViewById(R.id.btnMoreStory);
        btnMoreNotice = (ImageButton) findViewById(R.id.btnMoreNotice);
        btnMoreAnnounce = (ImageButton) findViewById(R.id.btnMoreAnnounce);
        btnMoreSpecial = (ImageButton) findViewById(R.id.btnMoreSpecial);
        btnMoreDev = (ImageButton) findViewById(R.id.btnMoreDev);
        btnMoreHelp = (ImageButton) findViewById(R.id.btnMoreHelp);
        btnMoreVersion = (ImageButton) findViewById(R.id.btnMoreVersion);
        btnMoreConfig = (ImageButton) findViewById(R.id.btnMoreConfig);
        
        btnMoreAccount.setOnClickListener(this);
        btnMoreStory.setOnClickListener(this);
        btnMoreNotice.setOnClickListener(this);
        btnMoreAnnounce.setOnClickListener(this);
        btnMoreSpecial.setOnClickListener(this);
        btnMoreDev.setOnClickListener(this);
        btnMoreHelp.setOnClickListener(this);
        btnMoreVersion.setOnClickListener(this);
        btnMoreConfig.setOnClickListener(this);
	}
	
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		MoreActivity parentActivity = (MoreActivity)getParent();
		
		if(v.getId() == btnMoreAccount.getId())
			startActivity(new Intent(getBaseContext(), MoreAccountActivity.class));
		else if(v.getId() == btnMoreStory.getId())
			parentActivity.startChildActivity("MoreStory", new Intent(this, MoreStoryActivity.class));
		else if(v.getId() == btnMoreNotice.getId())
			parentActivity.startChildActivity("MoreNotice", new Intent(this, MoreNoticeActivity.class));
		else if(v.getId() == btnMoreAnnounce.getId())
			parentActivity.startChildActivity("MoreAnnounce", new Intent(this, MoreAnnounceActivity.class));
		else if(v.getId() == btnMoreSpecial.getId())
			parentActivity.startChildActivity("MoreSpecial", new Intent(this, MoreSpecialActivity.class));
		else if(v.getId() == btnMoreDev.getId())
			parentActivity.startChildActivity("MoreDev", new Intent(this, MoreDevActivity.class));
		else if(v.getId() == btnMoreHelp.getId())
			parentActivity.startChildActivity("MoreHelp", new Intent(this, MoreHelpActivity.class));
		else if(v.getId() == btnMoreVersion.getId())
			parentActivity.startChildActivity("MoreVersion", new Intent(this, MoreVersionActivity.class));
		else if(v.getId() == btnMoreConfig.getId())
			parentActivity.startChildActivity("MoreConfig", new Intent(this, MoreConfigActivity.class));
	}
	
	@Override
	public void onBackPressed() {
		// TODO Auto-generated method stub
		super.onBackPressed();
	}
	
	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		for(int i = 0 ; i < 5; i++)
        	TrainTravelActivity.tabHost.getTabWidget().getChildAt(i).setBackgroundResource(R.drawable.bg_nav2);
	}
}
